Skip to content

Part of #38210: Audit Logs show exact time, affected asset, field path and old → new values - #38290

Merged
Rohit0301 merged 12 commits into
mainfrom
Rohit0301/audit-logs-exact-details-request
Nov 25, 2026
Merged

Rohit0301 merged 12 commits into
mainfrom
Rohit0301/audit-logs-exact-details-request

Conversation

@Rohit0301

@Rohit0301 Rohit0301 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Part of #38210

Settings → Access Control → Audit Logs showed only a relative time and the server's one-line summary. That summary drops the column name, shows only the new value and cuts off at 80 characters. The API already returns eventTs and the full changeEvent.changeDescription, so this PR renders them. UI only; the API and the Export are unchanged.

Each row in the list now shows:

  • Exact time: e.g. Nov 25, 2026, 04:27 PM (UTC+05:30) · 1 minute ago, using the existing formatDateTime, so the user's 12h/24h setting applies.
  • Header: the user, a Bot badge, the event-type badge (colored for all 11 audited event types), "Impersonated By" when set, and the affected asset as a link with its full name.
  • One line per field change: a colored Added / Updated / Removed word, the full field path (Columns › customer_id › Tags), and the value.
    • Updates read inline as old (red, struck through) → new (green).
    • Long values are cut to 3 lines.
    • Tags, tiers, glossary terms and domains render as core Tags with a colored dot; owners render as core OwnerChips.
    • A list of objects (e.g. test case results) shows one inline key value record per item, up to 5. A single object (e.g. pipeline status) shows as inline key value pairs. Statuses get colored pills and IDs are shortened.
  • Lineage events: linked from → to tables instead of the raw entityLineageAdded summary.
  • Events with no field changes (create / delete / restore / login) keep the server summary.

Pure logic lives in the new AuditLogList.utils.ts.

Backports: 2.1 #38686 (same code), 2.0 #38687 (2.0 has no OwnerChip, getSettingsLink or Badge href, so owners stay a linked chip there).

Not in this PR (follow-ups on #38210): the Event Type and Service filters, and a per-event detail view.

Type of change:

  • Improvement

High-level design:

  • AuditLogList.utils.ts (pure, no React) parses each FieldChange into a typed ChangeValue: refs (tags, tiers, glossary terms, domains, owners, other entity references), records (a list of objects), keyValue (a single object) or text. It also formats inline values (dates, statuses, IDs), builds links and reads lineage edges.
  • AuditLogList.component.tsx renders the row (header, change lines, meta line) from those types with core Badge, Tag/TagGroup, OwnerChip, Box and Typography. The list shell, empty states and skeleton are unchanged.
  • Alternative rejected: a richer server summary. A single string can't link to the asset or render old → new values cleanly.

Tests:

Use cases covered

  • Exact date-time on every entry.
  • Column-level change names its table (link and full name) and its column.
  • An update shows old → new; false/0 new values are kept; quoted column names are unquoted.
  • Tags, tiers, glossary terms and domains render as core Tags; owners render as OwnerChip, struck through when removed.
  • Object lists render as records (capped at 5 with "+ N More"), objects as inline key-value pairs.
  • Lineage events show linked from → to.
  • Create / delete / restore / login show the summary; login doesn't repeat the actor as the asset.
  • Every audited event type has a color; a new EventType makes the test fail until it is classified.

Unit tests

  • src/components/AuditLog/AuditLogList.test.tsx (32 tests, component behaviour)
  • src/components/AuditLog/AuditLogList.utils.test.ts (53 tests, all utils exports)
  • npx jest src/components/AuditLog src/pages/AuditLogsPage src/components/discovery/personal-space/Profile/tabs/access-control → 206 passed.
  • Coverage: AuditLogList.component.tsx 98.9% lines, AuditLogList.utils.ts 98.6% lines.

Backend integration tests

  • Not applicable (no backend changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not run locally. playwright/e2e/Pages/AuditLogs.spec.ts was checked by reading it: every data-testid it uses is still rendered. Pending: run that spec.

Manual testing performed

  1. Ran this branch's UI (DEV_SERVER_TARGET=http://localhost:8585 npx vite) against a local server.
  2. As admin via the API:
    • Created a glossary and a term, updated and soft-deleted the term, then restored it.
    • On snowflake_demo.SALES_DB.PUBLIC.customer: added a tier, a classification tag, a glossary term, a domain and a team owner, then removed a tag. Edited the table and column descriptions.
    • Added, updated and deleted lineage to customer_orders.
    • Created and hard-deleted a glossary, and logged in.
  3. Opened the Audit Logs page and checked each event type. Test-suite results, pipeline status, Fields Changed with impersonation, and a long description were injected into the response in the browser, because the local server has no such events.
  4. Reverted the demo table changes and deleted the demo glossaries.

UI screen recording:

Screenshots below. Not applicable — a recording was waived by the author; this improves an existing page, and the screenshots show every event type.

Audit Logs page

All audit log event types

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>. Not done: this is a partial delivery of Audit Logs UI: show the details the API already returns (exact time, affected asset, field path, old → new values) #38210, so the title says Part of.
  • My PR is linked to a GitHub issue (Part of #38210).
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable.
  • For a UI feature or feature task: a recording was waived by the author; screenshots are attached above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    • Reviewed SHA: 745e28b.
    • Fixed: owners now use the core OwnerChip (single-source rule); HTML entities are decoded; object lists no longer say "N results"; the event-color test now covers the whole EventType enum; two assertions that could never fail are removed; the entity-type lookup is shared.
    • Answered: tags, tiers, glossary terms and domains use the core Tag without links by design decision, since the core Tag has no href. Status colors are a UI heuristic, because the server has no classification for these free-form status strings.
  • Decision check: no durable decision.

🤖 Generated with Claude Code

@Rohit0301

Copy link
Copy Markdown
Contributor Author

Closing for now; will recreate once the design for the new audit log elements is ready.

@Rohit0301 Rohit0301 closed this Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: all test files (no impact map from main yet)

Result: ✅ 1072 passed · 154 skipped

Changed files no browser test loads
  • src/components/AuditLog/AuditLogList.component.tsx
  • src/components/AuditLog/AuditLogList.utils.ts

…keep angle-bracket text such as map<string,int>

Part of #38210
@gitar-bot

gitar-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 2 closed / 2 findings

The audit-log UI now parses and truncates field-change values to five records or three lines, which could hide details users rely on when inspecting events.

Renders exact timestamps, affected assets, field paths and old-to-new values for each Audit Logs entry, with core Tag and OwnerChip components for tags, owners and similar fields. Resolved the Typography colour being set via className, which contradicted the core-styling ADR, and the HTML-stripping that dropped angle-bracket text such as map<string,int>. No open issues found.

✅ 2 closed
✅ Quality: Core Typography text colour set via className, contradicting core-styling ADR

📄 openmetadata-ui/src/main/resources/ui/src/components/AuditLog/AuditLogList.component.tsx:286 📄 openmetadata-ui/src/main/resources/ui/src/components/AuditLog/AuditLogList.component.tsx:356 📄 openmetadata-ui/src/main/resources/ui/src/components/AuditLog/AuditLogList.component.tsx:367 📄 openmetadata-ui/src/main/resources/ui/src/components/AuditLog/AuditLogList.component.tsx:403 📄 openmetadata-ui/src/main/resources/ui/src/components/AuditLog/AuditLogList.component.tsx:432 📄 openmetadata-ui/src/main/resources/ui/src/components/AuditLog/AuditLogList.component.tsx:449 📄 openmetadata-ui/src/main/resources/ui/src/components/AuditLog/AuditLogList.component.tsx:463
This contradicts an Accepted record, so it blocks the merge. ADR:2026-10-11-migrated-antd-components-adopt-core-styling says call sites must not set text colour on a core component through className. They should use its props. The new list does this in several places:

  • <Typography className="tw:text-tertiary"> for the arrow and the dash separators, the impersonated-by text, the FQN, the timestamp and the "+ N More" line.
  • className="tw:text-secondary" on the entity-type label.
  • className="tw:text-quaternary" on the header dash.

The core Typography already has color="secondary" and color="quaternary", so the plain prop covers two of these. tertiary is not in TypographyColor. Under the ADR, that gap gets fixed by adding a tertiary colour to core, not by overriding it at the call site. The other option is a superseding ADR amendment.

✅ Edge Case: HTML-stripping drops angle-bracket text such as map<string,int>

📄 openmetadata-ui/src/main/resources/ui/src/components/AuditLog/AuditLogList.utils.ts:224-238
toPlainText runs every string value through DOMParser. Any <word...> sequence therefore becomes a parsed element and disappears from textContent, even when the value is not HTML. A column dataTypeDisplay change like map<string,int> or array<struct<a:int>> would show up as map or array>. That is the wrong old or new value in an audit log. Only parse when the value actually looks like HTML (for example a known block or inline tag, or an entity), or fall back to the raw string for fields that are not descriptions.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@Rohit0301
Rohit0301 enabled auto-merge (squash) November 25, 2026 13:17
@Rohit0301
Rohit0301 merged commit 70fcb67 into main Nov 25, 2026
61 of 63 checks passed
@Rohit0301
Rohit0301 deleted the Rohit0301/audit-logs-exact-details-request branch November 25, 2026 13:23
Rohit0301 added a commit that referenced this pull request Nov 25, 2026
…ld path and old → new values (backport 2.1 #38290) (#38686)

* [2.1] Part of #38210: Audit Logs show exact time, affected asset, field path and old → new values (backport 2.1 #38290)

* Audit Logs: import order for ui-checkstyle; record the 5-record cap and 3-line clamp (ADR)

Part of #38210

* Audit Logs: Typography colour via the color prop (core-styling ADR); keep angle-bracket text such as map<string,int>

Part of #38210
Rohit0301 added a commit that referenced this pull request Nov 25, 2026
…ld path and old → new values (backport 2.0 #38290) (#38687)

* [2.0] Part of #38210: Audit Logs show exact time, affected asset, field path and old → new values (backport 2.0 #38290)

* Audit Logs: import order for ui-checkstyle; record the 5-record cap and 3-line clamp (ADR)

Part of #38210

* Audit Logs: keep angle-bracket text such as map<string,int> (only parse real HTML)

Part of #38210
ShaileshParmar11 added a commit that referenced this pull request Nov 26, 2026
…rticle-permission and Audit Logs backports (#38887)

* test(playwright): align Context Center and Audit Logs specs with 2.0 backports

Two 2.0 backports changed the UI without updating these specs, so they fail
on every 2.0 nightly.

- ContextCenterPermission: #38821 (#38800) gates the article header on the
  article's own permission. The spec's article had no owner, and
  OrganizationPolicy-NoOwner-Rule lets any user set the owner of an unowned
  asset, so edit-owner-btn is now correctly shown to view-only and Data
  Consumer users. Give the article an owner (the admin) so the check is about
  EditOwners again, and open that article in the role-based tests instead of
  whichever article is first in the tree.
- AuditLogs: #38687 (#38290) renders the change summary with
  data-testid="description-content" instead of the description-content class.
  Select it by test id, as main's spec already does.

* test(playwright): drop the two ContextCenterPermission positional-locator suppressions this change removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants